package com.wenbo.wenbo.risk;


import com.wenbo.wenbo.kafka.KafkaProducer;
import com.wenbo.wenbo.service.BirthdayService;
import com.wenbo.wenbo.service.FishService;
import com.wenbo.wenbo.service.ITenantService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Date;

/**
 * 定时任务类
 */
@Component
public class ScheduledTask {

    private static final Logger log = LoggerFactory.getLogger(ScheduledTask.class);
    @Resource
    private FishService fishService;
    @Resource
    private BirthdayService birthdayService;
    @Resource
    private ITenantService tenantService;


    /**
     * 每天早上10点发送短信给老婆
     */
    //@Scheduled(cron = "0 0 10 * * ?")
//    public void scheduledTask() {
//        fishService.childrenInfo();
//        log.info("定时任务：" + new Date());
//    }

    /**
     * 每天早上9点检查有人过生日没有
     */
    @Scheduled(cron = "0 0 9 * * ?")
    public void scheduledTask2() {
        birthdayService.wishes();
        log.info("定时任务：" + new Date());
    }

    /**
     * 每天早上10点检查有人需要交房租没有
     */
    @Scheduled(cron = "0 0 10 * * ?")
    public void scheduledTask3() {
        tenantService.tenant();
        log.info("定时任务：" + new Date());
    }


}
